export let user_playlist = {
  namespaced: true,
  state: {
    user_playlist_data: {}
  },
  actions: {
    getUserPlaylist(store, data = {}) {
      let url = "/user/playlist?uid=" + data.uid + "&timestamp=" + new Date().getTime();
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit('setUserPlaylist', data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            // 请求已发出，但服务器响应的状态码不在 2xx 范围内
            reject(error.response.data)
          }
        });
      });
    }
  },
  mutations: {
    setUserPlaylist(state, data) {
      state.user_playlist_data = data;
    }
  }
}
